package it.uniroma2.controller;

import it.uniroma2.MonitorClient;
import it.uniroma2.cloud.PROVIDER;
import it.uniroma2.controller.LoadChecker.LoadCheck;
import it.uniroma2.controller.LoadChecker.LoadCheckExecutor;
import it.uniroma2.monitor.client.DateUtils;
import it.uniroma2.monitor.client.MetricRequest;
import it.uniroma2.monitor.client.MetricResult;

import java.util.Date;
import java.util.Timer;
import java.util.TimerTask;

import org.joda.time.DateTime;
import org.joda.time.DateTimeZone;

public class TimerTaskTest {

	private Timer timer;

	public TimerTaskTest() {
		scheduleTimerTasks(0);
	}

	private void scheduleTimerTasks(int secondsDelay) {
		timer = new Timer();
		timer.scheduleAtFixedRate(new ExtTimerTask(), secondsDelay * 1000L, // initial
														// delay
				30 * 1000);
	}

	class ExtTimerTask extends TimerTask {

		public void run() {
			System.out.println(new Date());
			new Thread(new TaskExecutor()).start();
		}
	}

	class TaskExecutor implements Runnable {

	

		public TaskExecutor() {
		}

		@Override
		public void run() {
			if (false) {
				timer.cancel();
				scheduleTimerTasks(120);
			}

		}
	}

	public static void main(String[] args) {
		new TimerTaskTest();
	}
}
